pub fn odd_fibnacci_sum(threshold: u32) -> u32 {
    if threshold <= 1 {
        return threshold;
    }

    let mut a = 0;
    let mut b = 1;
    let mut sum = 1;

    loop {
        let s = a + b;
        if s >= threshold {
            break;
        }
        if s % 2 == 1 {
            sum += s;
        }
        a = b;
        b = s;
    }

    sum
}
